package littlecyberwar.model;


/**
 * This is a class that holds all commands issued by current player
 * Command is defined as changes to the game model
 * Thus only chnages to the model made by the owning player
 * need to go into the cmdQueue.
 * Changes made by other players are NOT stored in the CmdQueue, they are
 * directly applied to the model.
 * Thus when an undo from another user is made, an explicit undo command
 * is applied to the model directly (not through cmd queue)
 *
 * The CmdQueue consists of a FIFO data structure used to hold the last n commands
 * issued. Only cmds in the FIFO can undo/redo. Once a cmd falls out of the FIFO, then it'll be
 * spooled into a "backing-store".
 *
 * The backing store is either a file (if we are in PBEM mode), or a socket (if we are in FTF mode).
 *
 * The entire CmdQueue interface are static method since the cmdQueue is a singleton for one instance
 * of the program.
 */
public class CmdQueue {
	

	private PlayingBoardModel model;	// the playing board model used to set/get stuff
	
	
  /**
   * setup the game model during initialization time
   */
  protected static void setModel( PlayingBoardModel modelIn ) {
  }

  /**
   * Once the game is started as either 1) a PBEM game, or 2) networked
   * then a corresponding backing store object is created and connected
   * here.
   * When the command is added to the CmdQueue, the cmd is then added to the
   * backing store and it'll do the right thing.
   */
  public static void setBackingStore( CmdBackingStore bs ) {
  }

  /**
   * This is the main call from the model that'll enter the command to the queue
   */
  public static void setCommand( Command cmd ) {
  }

  /**
   * This will return the last command on the queue back to the caller
   * It'll also take the command out of the queue.
   */
  public static Command undo () {
  	return ( null );
  }

  /**
   * This is called when the cmdQueue (basically a write buffer) needs to be flushed out to
   * the backing store so the BS can be wrapped up.
   */
  public static void flush() {
  }
}